
import { Badge, Button, Popover } from 'antd';

export const AformConfig = [
    {
        type: "Input",
        lable: "称呼",
        placenholder: "请输入称呼",
        key: "name",
    },
    {
        type: "Input",
        lable: "Email",
        placenholder: "请输入联系方式",
        key: "email",
    },
    {
        type: "Select",
        lable: "状态",
        placenholder: "请输入联系方式",
        key: "pass",
        options: [
            {
                key: "1",
                lable: "已通过"
            },
            {
                key: "0",
                lable: "未通过"
            }
        ]
    },
    {
        type: "Find",
        text: "收搜"
    },
    {
        type: "Reset",
        text: "重置"
    }
]
export const tableColumns = (
    PassCommrnt: (id: number, flag: boolean) => void,
    Recomment: (record: object) => void,
    DeleteComment: (id: number) => void) => {
    return [
        {
            title: '状态',
            dataIndex: 'pass',
            key: 'pass',
            render(text: boolean) {
                return text ? <span><Badge status="success" ></Badge> 通过</span> : <span><Badge status="warning" ></Badge> 未通过</span>
            }
        },
        {
            title: '称呼',
            dataIndex: 'name',
            key: 'name',
        },
        {
            title: '联系方式',
            dataIndex: 'email',
            key: 'email',
        },
        {
            title: '原始内容',
            dataIndex: 'content',
            key: 'content',
            render: (text: any) => {
                return <Popover content={text} >
                    <a href="">查看内容</a>
                </Popover>
            }
        },
        {
            title: 'HTML内容',
            dataIndex: 'html',
            key: 'html',
            render: (text: any) => {
                return <Popover content={text} >
                    <a href="">查看内容</a>
                </Popover>
            }
        },
        {
            title: '管理文章',
            dataIndex: 'archive',
            key: 'archive',
            render: (text: any) => {
                return <Popover content={text} >
                    <a href="">查看内容</a>
                </Popover>
            }
        },
        {
            title: '创建时间',
            dataIndex: 'createAt',
            key: 'createAt',
        },
        {
            title: '父级评论',
            dataIndex: 'comm',
            key: 'comm',
        },
        {
            title: '操作',
            dataIndex: 'action',
            key: 'action',
            render: (_: any, record: any) => {
                // const id=record.id
                // console.log(_, record)
                const id = record.id
                return (
                    // PassCommrnt: (id: number, flag: boolean) => void,
                    // Recomment: (record: object) => void,
                    // DeleteComment: (id: number) => void
                    <>
                        <Button type='link' onClick={() => PassCommrnt(id, true)}>通过</Button>
                        <Button type='link' onClick={() => PassCommrnt(id, false)}>拒绝</Button>
                        <Button type='link' onClick={() => { Recomment(record) }}>回复</Button>
                        <Button type='link' onClick={() => { DeleteComment(id) }}>删除</Button>
                    </>
                )
            }
        }
    ];

}


export const tableData = [
    {
        key: "1",
        status: "通过",
        name: "Han Solo",
        email: "test123@qq.com",
        content: "查看内容",
        html: "查看内容",
        archive: "文章",
        data: "2022-07-30 10:21:38",
        comm: "无",
        action: ["通过", "拒绝"]
    },
    {
        key: "1",
        status: "通过",
        name: "Han Solo",
        email: "test123@qq.com",
        content: "查看内容",
        html: "查看内容",
        archive: "文章",
        data: "2022-07-30 10:21:38",
        comm: "无",
        action: ["通过", "拒绝"]
    },
    {
        key: "1",
        status: "通过",
        name: "Han Solo",
        email: "test123@qq.com",
        content: "查看内容",
        html: "查看内容",
        archive: "文章",
        data: "2022-07-30 10:21:38",
        comm: "无",
        action: ["通过", "拒绝"]
    },
    {
        key: "1",
        status: "通过",
        name: "Han Solo",
        email: "test123@qq.com",
        content: "查看内容",
        html: "查看内容",
        archive: "文章",
        data: "2022-07-30 10:21:38",
        comm: "无",
        action: ["通过", "拒绝"]
    }
]
